from pyecharts.options import VisualMapOpts
from pyecharts.charts import Map
from pyecharts.options import VisualMapOpts

china_map = Map()

data = [
    ("北京市", 99),
    ("上海市", 199),
    ("湖南省", 89),
    ("台湾省", 100),
    ("安徽省", 299),
    ("广东省", 399),
    ("湖北省", 599)
]

china_map.add("测试地图", data, "china")

# 设置全局选项
china_map.set_global_opts(
    visualmap_opts=VisualMapOpts(
        is_show=True,
        is_piecewise=True,
        pieces=[
            {"min": 1, "max": 99, "label": "1-99", "color": "#CCFFFF"},
            {"min": 100, "max": 199, "label": "100-199", "color": "#FF6666"},
            {"min": 200, "max": 600, "label": "200-600", "color": "#990033"}
        ]
    )
)

china_map.render()
